/**
 * 
 */
package com.lz.ovuola.web.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;

/**
 * session lazy加载
 *
 */
@Configuration
public class CustomOpenEntityManagerInViewFilter {

	@Bean
	public FilterRegistrationBean registerOpenEntityManagerInViewFilterBean() {
		FilterRegistrationBean registrationBean = new FilterRegistrationBean();
		OpenEntityManagerInViewFilter filter = new OpenEntityManagerInViewFilter();
		filter.setEntityManagerFactoryBeanName("entityManagerFactoryDynamic");
		registrationBean.setFilter(filter);
		return registrationBean;
	}
}
